package com.example.test15middleware.test;

import com.example.test15middleware.Test15MiddlewareApplication;
import com.example.test15middleware.producer.KafkaProducer;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Date;

/**
 * @Author: fxy
 * @Date: 2022/03/22/16:38
 * @Description:
 */
public class Demo {
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Test15MiddlewareApplication.class, args);
        KafkaProducer producer = run.getBean(KafkaProducer.class);
        for(int i=0;i<3;i++){
            producer.send("yun_test",String.valueOf(new Date()));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }

}
